package com.liujit.auth.controller;

import com.liujit.auth.domain.param.WxLoginParams;
import com.liujit.auth.domain.result.WxLoginResult;
import com.liujit.auth.wx.service.WxOauthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author: liujun
 * @date: 2021/6/21 10:41 下午
 * @description: 微信小程序认证接口
 */
@RequiredArgsConstructor
@Api(tags = "微信小程序认证接口")
@RestController
@RequestMapping("/oauth/wx")
public class WxOauthController {

    private final WxOauthService wxOauthService;

    @ApiOperation(value = "微信登录", notes = "根据微信登录请求参数，进行微信登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "WxLoginParams", value = "微信登录请求参数", dataType = "WxLoginParams", dataTypeClass = WxLoginParams.class, paramType = "body") })
    @PostMapping("/login")
    public WxLoginResult login(@RequestBody WxLoginParams params) {
        return wxOauthService.login(params);
    }
}
